package com.nhim.cms.admin.server.locator;

import com.google.web.bindery.requestfactory.shared.Locator;
import com.nhim.cms.dao.ContentTypeDAO;
import com.nhim.cms.dao.IContentTypeDAO;
import com.nhim.cms.domain.ContentType;

public class ContentTypeLocator extends Locator<ContentType, Integer>{

	IContentTypeDAO contentTypeDAO = ContentTypeDAO.getInstance();
	
	@Override
	public ContentType create(Class<? extends ContentType> arg0) {
		return new ContentType();
	}

	@Override
	public ContentType find(Class<? extends ContentType> domain, Integer id) {
		if(id == null)
			return new ContentType();
		return contentTypeDAO.findById(id);
	}

	@Override
	public Class<ContentType> getDomainType() {
		return ContentType.class;
	}

	@Override
	public Integer getId(ContentType domain) {
		return domain.getId();
	}

	@Override
	public Class<Integer> getIdType() {
		return Integer.class;
	}

	@Override
	public Object getVersion(ContentType domain) {
	return domain.getVersion();
	}

}
